import { postSettingList, postSettingEdit } from '../../service/api'
import { defineStore } from 'pinia'
const useSetStore = defineStore('setting', {
  state: () => ({
    setting: {
      header: [
        {
          title: '梳棉机',
          label: '第一块',
          path: '/machine_sm'
        },
        {
          title: '预并备桶区',
          label: '第二块',
          path: '/machine_yb'
        },
        {
          title: '缓存区',
          label: '第三块',
          path: '/area'
        },
        {
          title: '配台',
          label: '第四块',
          path: '/handle'
        },
        {
          title: '机器人',
          label: '第五块',
          path: '/robot'
        }
      ],
      smBandType: '绑定点',
      sm: {
        machineControl: true,
        machineEmpty: true,
        machineFull: true,
        machineSelect: '产线',
        guidao: true
      },
      ybArea: {
        changeAuto: false,
        number: 2,
        height: 4,
        areaType: true,
        areaIo: true,
        areaAuto: true,
        areaStatus: true,
        areaLock: true
      },
      hcArea: {
        number: 3,
        height: 4,
        areaType: true,
        areaIo: true,
        areaAuto: true,
        areaStatus: true,
        areaLock: true
      },
      area: [],
      process: '梳并工序'
    }
  }),
  actions: {
    changeSetting(data) {
      this.setting = data
    },
    async getSettingList() {
      const settingResult = await postSettingList()
      this.setting = settingResult.data
    },
    async getSettingEdit(data) {
      const settingEditResult = await postSettingEdit(data)
    }
  }
})

export default useSetStore
